package com.panda.multiple.tenant.controller;

import com.panda.multiple.tenant.domain.vo.UserVO;
import com.panda.multiple.tenant.service.UserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping(value = "user")
public class UserController {

    @Resource
    private UserService userService;

    @GetMapping(value = "getUserById")
    public UserVO getUserById(Long id) {
        return userService.getUserById(id);
    }

    @PostMapping(value = "updateById")
    public void updateById(@RequestBody UserVO userVO) {
        userService.updateById(userVO);
    }

    @PostMapping(value = "addUser")
    public void addUser(@RequestBody UserVO userVO) {
        for (int i = 0; i < 10; i++) {
            userVO.setId(1001L);
            userVO.setName("燕双鹰");
            userVO.setNickName("你大爷的");
            userVO.setMobilePhone("13655887744");
            userVO.setIdCard("350781196403074201");
            userService.addUser(userVO);
        }
    }
}
